DOC Skip to main content

C++ Sample Double Infrared Viewer

Update on 2025-07-25 09:08:23

Supported devices: Only supports Gemini 300 series, Gemini 2 XL, Gemini 2 VL

Function description: Demonstrate obtaining dual infrared camera images, displaying left and right infrared images, and exiting the program with the ESC_KEY key

| This example is based on the C++High Level API for demonstration

Create a pipeline to get devices


  ob::Pipeline pipe;

Configure Left IR

// Get the ir_left camera configuration list
auto irLeftProfiles = pipe.getStreamProfileList(OB_SENSOR_IR_LEFT);

if(irLeftProfiles == nullptr) {
    std::cerr
        << "The obtained IR(Left) resolution list is NULL. For monocular structured light devices, try opening the IR data stream using the IR example. "
        << std::endl;
    return 0;
}

// Open the default profile of IR_LEFT Sensor, which can be configured through the configuration file
try {
    auto irLeftProfile = irLeftProfiles->getProfile(OB_PROFILE_DEFAULT);
    config->enableStream(irLeftProfile->as<ob::VideoStreamProfile>());
}
catch(...) {
    std::cout << "IR(Left) stream not found!" << std::endl;
}

Configure Right IR

// Get the ir_right camera configuration list
auto irRightProfiles = pipe.getStreamProfileList(OB_SENSOR_IR_RIGHT);

// Open the default profile of IR_RIGHT Sensor, which can be configured through the configuration file
try {
    auto irRightProfile = irRightProfiles->getProfile(OB_PROFILE_DEFAULT);
    config->enableStream(irRightProfile->as<ob::VideoStreamProfile>());
}
catch(...) {
    std::cout << "IR(Right) stream not found!" << std::endl;
}

Open pipeline

pipe.start(config);

Get frame data

auto leftFrame  = frameSet->getFrame(OB_FRAME_IR_LEFT);
auto rightFrame = frameSet->getFrame(OB_FRAME_IR_RIGHT);

Stop pipeline

pipe.stop();

Expected Output

ON THIS PAGE

Add

  • Name:

  • Link Address:

Cancel

Add

  • Name:

  • Link Address:

Cancel
Questions or
Feedback?

Feedback

  • Your feedback matters! Share your thoughts on this page, report errors, or let us know how we can improve to better support your needs. If applicable, please include the specific sentence or section to help us identify and address the issue.